<?php
/**
 +------------------------------------------------------------------------------
 * SoloPHP PHP框架
 +------------------------------------------------------------------------------
 * $Author: Yotianya <yotianya@gmail.com>
 * $Dtime:2011-10-24
 * $Copyright: CopyRight By SoloPHP Yotianya
 +------------------------------------------------------------------------------
 */

class SoloPHP{

	/*
	 +------------------------------------------------------------------------------
	 * 定义文件夹全局变量; 加载框架必须文件
	 +------------------------------------------------------------------------------
	 * 定义分隔符、框架根目录、项目根目录、框架各功能目录
	 * 加载框架必须文件
	 +------------------------------------------------------------------------------
	 */
	public function start() {
		
		!defined('ACT') && define ( 'ACT',   ( $GLOBALS['C']['Common']['ReWrite'] ? APP :$_SERVER ['SCRIPT_NAME']) );//主路径	
		!defined('ROOT_PATH') && define('ROOT_PATH', str_replace('\\', '/', dirname(__FILE__).S));//ROOT_PATH框架主体在的目录
        !defined('APP') &&define ( 'APP', str_replace($_SERVER["DOCUMENT_ROOT"], '',str_replace('\\', '/', APP_PATH.S)));//APP目录 相对路径
        !defined('APP_FILE') &&define("APP_FILE",basename($_SERVER["SCRIPT_FILENAME"],".php")); //入口文件名 用于判定模板目录 (index/admin)


		$appDirName = array ('Core', 'Extensions','Odb');
		foreach ( $appDirName as $value ) {
			define ( strtoupper ( $value ), ROOT_PATH.$value.'/' );
		}
		$appFolderName = array ('Controller', 'Cache', 'Model','View','Lib','Func');
		foreach ( $appFolderName as $value ) {
			define ( strtoupper ( $value ), APP_PATH.'/'.$value.'/' );
		}
		require (CORE.'Function.php');
		$requireFile = array ('Controller','Model','View','Template');
		foreach ( $requireFile as $value ) {
			$file=CORE.$value.'.class.php';
			if(!file_exists($file)){
			errorMsg ( 'fileNotExist', $file,__FILE__);
			}
			importFile($file);
		}
		newClass('Controller')->Run();	     	  		//实例化控制器
	}
}


